package de.au.fi.imp.reader.yahoodata;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.StringTokenizer;

import junit.framework.Assert;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import de.au.fi.calc.CalcHelper;
import de.au.fi.domain.Stock;
import de.au.fi.imp.ImportHelper;

public class YahooStockImporter {
	
	Logger log = LoggerFactory.getLogger(this.getClass());


	public YahooStockImporter() {
	}

	public List<Stock> importYahooStocks(String... tickers) throws Exception {
		YahooDataReader yahooDataReader = new YahooDataReader();
		List<String> yahooResult = yahooDataReader
				.getStocksWithBasicData(tickers);
		List<Stock> stocks = new YahooResultMapper().mapYahooDataToStocks(yahooResult);
		log.debug("Got {} stocks for tickers {}", stocks.size(), tickers);
		return stocks;
	}
	
}
